﻿@model ProductsByTagModel
@using Nop.Web.Models.Catalog;
@{
    Layout = "~/Views/Shared/_ColumnsThree.cshtml";

    //title
    Html.AddTitleParts(string.Format(T("PageTitle.ProductsByTag").Text, Model.TagName));
}
@using Nop.Core;
@using Nop.Core.Infrastructure;
@using Nop.Web;
@using Nop.Web.Framework.UI;
@using Nop.Web.Models.Catalog;
@using Nop.Web.Extensions;
<div class="page product-tag-page">
    <div class="category-title">
        <h2 class="title">@String.Format(T("Products.Tags.ProductsTaggedWith").Text, Model.TagName)</h2>
    </div>
    @Html.Widget("productsbytag_top")
        <div class="product-selectors">
        @*view mode*@
        @if (Model.PagingFilteringContext.AllowProductViewModeChanging && Model.Products.Count > 0)
        {
            <div class="product-viewmode filtersDropDownPanel">
                <span>@T("Categories.ViewMode")</span>
                @Html.DropDownList("products-viewmode", Model.PagingFilteringContext.AvailableViewModes, new { onchange = "setLocation(this.value);" })
            </div>
        }   
    
    
@*sorting*@
        @if (Model.PagingFilteringContext.AllowProductSorting && Model.Products.Count > 0)
        {
            <div class="product-sorting filtersDropDownPanel">
                <span>@T("Categories.OrderBy")</span>
                @Html.DropDownList("products-orderby", Model.PagingFilteringContext.AvailableSortOptions, new { onchange = "setLocation(this.value);" })
            </div>
        }
    
@*page size*@
        @if (Model.PagingFilteringContext.AllowCustomersToSelectPageSize && Model.Products.Count > 0)
        {
            <div class="product-page-size filtersDropDownPanel">
                <span>@T("Products.Tags.PageSize")</span>
                @Html.DropDownList("products-pagesize", Model.PagingFilteringContext.PageSizeOptions, new { onchange = "setLocation(this.value);" })
                <span>@T("Products.Tags.PageSize.PerPage")</span>
            </div>
        }
    </div>
        @Html.Widget("productsbytag_before_product_list")
    @*product list*@
    @if (Model.Products.Count > 0)
    {
        if (Model.PagingFilteringContext.ViewMode == "list")
        {
@*list mode*@
        <div class="product-list">
            <div class="item-grid">
                @foreach (var product in Model.Products)
                {
                    <div class="item-box">
                        @Html.Partial("_ProductBox", product)
                    </div>
                }
            </div>
        </div>       
        }
        else
        {
@*grid mode*@
        <div class="product-grid">
            <div class="item-grid">
                @foreach (var item in Model.Products)
                {
                    <div class="item-box">
                        @Html.Partial("_ProductBox", item)
                    </div>
                }
            </div>
        </div>
        }
    }
    <div class="pager">
        @if (Model.PagingFilteringContext.TotalPages > 1)
        {
            <div>
                @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
            </div>                
            <div class="corner"></div>
        }
    </div>
    @Html.Widget("productsbytag_bottom")
</div>
